package com.beta.util;

import java.util.Random;

/**
 * Created by vector on 2016/11/28.
 */
public abstract class RandomUtils {

    /**
     * 生成制定长度的随机数
     * @param length
     * @return
     */
    public static String randomStringWithLength(int length) {
        StringBuilder codeBuilder = new StringBuilder();
        Random random = new Random();
        for (int i = 0; i < length; ++i) {
            codeBuilder.append(random.nextInt(10));
        }
        return codeBuilder.toString();
    }

}
